package cc.mrbird.febs.common.utils;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Slf4j
public class FebsUtil {

	/**
	 * 设置响应
	 *
	 * @param response    HttpServletResponse
	 * @param contentType content-type
	 * @param status      http状态码
	 * @param value       响应内容
	 * @throws IOException IOException
	 */
	public static void makeResponse(HttpServletResponse response, String contentType,
									int status, Object value) throws IOException {
		response.setContentType(contentType);
		response.setStatus(status);
		response.getOutputStream().write(JSONObject.toJSONString(value).getBytes());
	}
}